<html>
<head>
    <script src="resources/cross-frame-access.js"></script>
    <script>
        window.onload = function()
        {
            if (window.testRunner) {
                testRunner.dumpAsText();
                testRunner.waitUntilDone();
            }

            window.targetWindow = frames[0];

            log("----- tests for getting a targetWindow's location object's functions which have custom overrides.  The" +
                " desired behavior is for the targetWindow to return the builtin function, not the override -----\n");

            // We should test overriding using window.location.__proto__ once the Location object has a proper prototype.

            // Overriden using window.location.assign = function() { return "new assign" }
            shouldBeFalse("canGet('targetWindow.location.assign')");

            // Overriden using window.location.reload = "new reload"
            shouldBeFalse("canGet('targetWindow.location.reload')");

            // Overriden using window.location.replace = "new replace"
            shouldBeTrue("canGet('targetWindow.location.replace')");
            shouldBe("targetWindow.location.replace.name", "''");

            if (window.testRunner)
                testRunner.notifyDone();
        }
    </script>
</head>
<body>
<iframe src="http://localhost:8000/security/resources/cross-frame-iframe-for-location-get-override-test.html"></iframe>
<pre id="console"></pre>
</body>
</html>
